/*
 * vurl.h
 *
 *  Created on: Apr 24, 2011
 *      Author: xrose
 */

#ifndef VURL_H_
#define VURL_H_
#include <string>
#include <iostream>
#include "incdefault.h"

using namespace std;
class Url {
private:
	/**
	 * parse a string URL to _protocol, _hostname, _port, _identifier
	 */
	int parseURL(string url);
	/**
	 * parser
	 */
	int parseURL2(const char* url, char* hostname, int* port, char* identifier);
	/**
	 * field
	 */
	string _protocol;
	string _hostname;
	int _port;
	string _identifier;

public:
	/**
	 * default contructor
	 */
	Url();
	/**
	 * URL from string
	 */
	Url(string url);
	/**
	 * copy contrustor
	 */
	Url(const Url &url){
		_protocol = url._protocol;
		_hostname = url._hostname;
		_port = url._port;
		_identifier = url._identifier;
	}
	virtual ~Url();
	//----------------------
	string getProtocol(){
		return _protocol;
	}
	void setProtocol(string proto){
		_protocol = proto;
	}
	string getHostname(){
		return _hostname;
	}
	void setHostname(string hostnam){
		_hostname = hostnam;
	}
	int getPort(){
		return _port;
	}
	void setPort(int port){
		_port = port;
	}
	string getIdentifier(){
		return _identifier;
	}
	void setIdentifier(string identif){
		_identifier = identif;
	}
};

#endif /* VURL_H_ */
